import {useAppSelector, useAppDispatch} from '../../hooks/redux';
import {increment, incrementByAmount} from '../../store/redux/counter.slice';
import {RootState} from "../../store/redux/store";

export default function ReduxDemo() {
    const count = useAppSelector((state: RootState) => state.counter.value);

    const dispatch = useAppDispatch();

    return (
        <div className="ReduxDemo">
            {count}
            <button onClick={() => dispatch(increment())}>+1
            </button>
            <button onClick={() => dispatch(incrementByAmount(2))}>+2
            </button>
        </div>
    )
}